home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
mutt
/
hanoi.mut
< prev
next >
Wrap
Text File
|
1988-03-01
|
498b
|
22 lines
; Good ol towers of hanoi
; converted from xlisp to MUTT 12/86 C Durland
; Usage:
; (hanoi <n>)
; <n> - number of discs
(defun
print-move (from to)
{ (msg "Move Disk From " from " To " to) }
transfer (from to via)(int n)
{
(if (== n 1)(print-move from to)
{
(transfer from via to (- n 1))
(print-move from to)
(transfer via to from (- n 1))
})
}
hanoi {(transfer "A" "B" "C" (atoi (ask "n = ")))(msg "done.")}
)
(hanoi)